<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ page import="java.util.*,
						org.apache.commons.logging.Log, 
						org.apache.commons.logging.LogFactory,
						com.ophelisis.common.util.*,
						com.ophelisis.common.consts.*,
						com.ophelisis.actions.system.*"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="page" uri="/tld/xdp-page.tld"%>

<script>
$(document).ready(function() {
	$("#calendar").fullCalendar({
		theme: true,
		header: {
			left: 'prev,next today',
			center: 'title',
			right: ''
// 			right: 'month,agendaWeek,agendaDay'
		},
		editable: true,
		selectable: true,
		selectHelper: true,
		select: function(start, end, allDay){
			var startDate = new Date(start);
			var startYear = startDate.getFullYear();
			var startMonth = "0" + (startDate.getMonth() + 1);
			var startDay = "0" + startDate.getDate();
			
			var endDate = new Date(end);
			var endYear = endDate.getFullYear();
			var endMonth = "0" + (endDate.getMonth() + 1);
			var endDay = "0" + endDate.getDate();
			
			var startFullDate = startYear 
									+ "-" + startMonth.substring(startMonth.length - 2, startMonth.length)
									+ "-" + startDay.substring(startDay.length - 2, startDay.length);
			var endFullDate = endYear
									+ "-" + endMonth.substring(endMonth.length - 2, endMonth.length)
									+ "-" + endDay.substring(endDay.length - 2, endDay.length);
			
			pmModule.setAdd(startFullDate, endFullDate, allDay);
		}
	});
	if ("${_year}" != "") {
		$("#calendar").fullCalendar("gotoDate", new Date().getFullYear("${_year}-${_month}-01"), new Date("${_year}-${_month}-01").getMonth(), new Date("${_year}-${_month}-01").getMonth());
	}
});
</script>
<!-- Title Start -->
<%@ include file="/WEB-INF/jsp/common/resultMessageLocal.jsp"%>
<div id="formtitle">
	<input type="hidden" id="loadCheck" name="loadCheck" value="OK" />
	<form id="searchForm" name="searchForm" method="post">
	</form>
</div>
<!-- Title End -->
<!-- List Start -->
<div id="formlist1" class="noborder">
	<div id="calendar"></div>
</div>
<!-- List End -->
